//
//  SettingViewController.m
//  Pictorial
//
//  Created by SKY on 15/12/29.
//  Copyright © 2015年 sky. All rights reserved.
//

#import "SettingViewController.h"

#import "SettingView.h"

#import "Cache.h"
@interface SettingViewController ()<SettingViewDelegate>

@end

@implementation SettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
        
    SettingView *settingView = [[[NSBundle mainBundle] loadNibNamed:@"SettingMoreView" owner:nil options:nil] firstObject];
    [self.view addSubview:settingView];
    settingView.delegate = self;
}
-(void)moveToController:(NSInteger)index{
    switch (index) {
        case 0:
        case 1:
        case 2:{
            [_delegate moveToVC:index];
            break;
        }
        case 3:{
            [Cache cleanCache];
            UIAlertController *alertC = [UIAlertController alertControllerWithTitle:nil message:@"清除完毕" preferredStyle:UIAlertControllerStyleAlert];
            UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:nil];
            [alertC addAction:action];
            [self presentViewController:alertC animated:YES completion:nil];
            break;
        }
        default:
            break;
    }
    
    [self removeSetting];

}
-(void)removeSetting{
    [self.view removeFromSuperview];
    [self removeFromParentViewController];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
